home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-04 | 5.2 KB | 173 lines | [TEXT/MPS ] |
- #
- # File: SimpleSample.vu
- #
- # Contains: A script which creates a folder with 3 sub-folders and does
- # some simple user actions at a slow pace for you to observe.
- # Note that all lines starting with a '#' is a comment
- # (like this one).
- #
- #
- # Starting Configuration: In order for the script to run properly, the target
- # should be running Finder with all windows closed and one disk
- # icon selected. The target Macintosh should have a Printer
- # software installed. If you have access to a printer then use
- # the Chooser to select one.
- #
- # After Effects: This script creates a folder called "..VUSimpleSample.." in
- # the volume selected initially. Please throw it in the trash
- # after you execute this script once.
- #
- # Note: To stop the script execution while its running type Cmd-.
- # ie., Press the Command Key and type '.' (period). Be sure
- # to open the notebook to see a mini-description of what's going
- # on!
- #
- # Written by: Rick Violet
- #
- # Copyright: © 1990-1992 by Apple Computer, Inc., all rights reserved.
- #
- # Change History:
- #
- # 8/4/92 DGG Added printed comments.
- # 6/19/92 DGG Cleaned up
- # 1/21/90 Rick Created first draft
- # 1/24/90 naga Edited the script and comments
- #
- # To do:
- #
-
- #Tell VU to slow its movements for Demonstration purposes
- println "Now setting environment variables.";
- wait(2);
- Patience(2);
- MouseSpeed(10);
-
- # Let user know that the script is starting!
- println "### Virtual User! Simple Sample Now Running!";
-
- # Open the root window of the selected volume, by selecting "Open" from the
- # file menu.
- println "Selecting ∂"Open∂" from the ∂"File∂" menu.";
- wait(2);
- select [menuItem t:"Open"];
-
- # Unify the window's name into a variable (Volume_Name) for later use.
- println "Memorizing the title of the window.";
- wait(2);
- match[window o:1 t:?volumeName];
- println "The window title is ∂"{volumeName}∂".";
-
- # Initialize a variable for our folder's name.
- ourWindowName := "..VUSimpleSample..";
-
- # Create a new folder by selecting 'New', using the key equivalent.
- println "Now creating a new folder.";
- wait(2);
- pressKey k:{ commandKey };
- type k:{"n"};
- releaseKey k:{ commandKey };
-
- # We can rename the folder by simply typing, since it was just created.
- println "Now renaming the newly created folder.";
- type k:{ ourWindowName };
-
- # Open the new folder's window by selecting "Open" from the file menu.
- println "Opening the our ∂"{ourWindowName}∂" folder.";
- select [ menuitem t:"Open" ];
-
- # Check for 'Name already taken' dialog
- println "Looking for ∂'Name already taken∂' dialog.";
- if match [button t:"Ok" w:1]
- begin
- println "Target not setup to run this script";
- println "Please throw away the '{ ourWindowName }' folder.";
- exit;
- end;
-
- # Select and then Close the root window.
- # The variable volumeName contains the window's title.
- println "Selecting the ∂"{volumeName}∂" window.";
- wait(2);
- select [window t:volumeName];
- close [window t:volumeName];
-
- # Create 3 new folders in this folder using Command-n
- println "Creating three new folders in succession.";
- wait(2);
- pressKey k:{ commandKey };
- type k:{"nnn"};
- releaseKey k:{ commandKey };
-
-
- # Resize the window to be thin and as tall as the screen.
- # First find the rectangle of the main screen
- match [screen m:true r:?mainScreenRect];
-
- # Drag the window to the top-left corner of the screen
- println "Moving the window about.";
- wait(2);
- Drag [ window o:1 ] a:{ mainScreenRect[1],
- mainScreenRect[2] + 20 }; # bump down 20 for Menubar
-
- # Now resize the window.
- println "Resizing the window";
- wait(2);
- Size [ window o:1 ] w:180 h:(mainScreenRect[4] - mainScreenRect[2] - 20 );
-
- # View the window by small icon.
- println "Changing the view of the window.";
- wait(2);
- select [menuItem t:"by Small Icon" m:"View"];
-
- # Force Finder to clean up the window
- println "Now forcing finder to clean up the window.";
- wait(2);
- pressKey k:{ optionKey };
- select [menuItem t:"Clean up"];
- releaseKey k:{ optionKey };
-
- # Zoom the window out
- println "Zooming the window.";
- wait(2);
- zoom [window o:1];
-
- # Do Page setup
- println "Now acting with the page setup dialog.";
- wait(2);
- select [menuItem t:"Page Setup…" m:"File"];
-
- # If Page setup dialog comes up.
- if (match [radioButton t:"US letter" w:1])
- begin
- # Select a radio button, "US letter".
- println "Selecting ∂"US Letter∂" paper size.";
- wait(2);
- select [radioButton t:"US letter" w:1];
-
- # Check any check boxes that are currently un-checked in the front window.
- # First, collect the list of all un-checked boxes in the front window.
- AllMarkedCheckBoxes := collect [checkBox s:{0,1} w:1]!;
-
- # For each one in the list, check the box
- println "Checking boxes.";
- wait(2);
- for each singleBox in AllMarkedCheckBoxes
- select [checkBox t:singleBox.t r:singleBox.r w:1];
- end;#if Page setup dialog comes back
-
- # Dismiss the dialog.
- select [button t:'Ok' w:1];
-
- println "Now performing final organization actions.";
- wait(2);
-
- # Close the window titled '..VUSimpleSample..'
- close [window t:ourWindowName];
-
- # Open the root volume window.
- select [menuItem t:'Open' m:'File'];
-
- # Let user know that the script has finished.
- println "### Virtual User! Simple Sample completed!";
- println "### Please, don't forget to trash the '{ourWindowName}'∂n",
- "### folder on your target Macintosh!";